

import axios from 'axios';
import Cookies from 'js-cookie';

const userClient = axios.create({
  
  timeout: 5000,
});

// 拦截请求并加上 token
userClient.interceptors.request.use((config) => {
  const token = Cookies.get('loginToken');
  if (token) {
    config.headers.Authorization = `Bearer ${token}`;
  }
  return config;
}, (error) => Promise.reject(error));

export default userClient;